package constant;

import java.util.Properties;

public class DatabaseConfig {
    // 数据库连接配置
    public static final String DB_URL = "jdbc:mysql://localhost:3306/chatting_records";    // 数据库连接地址
    public static final String DB_USERNAME = "YuMo";                                       // 数据库用户名
    public static final String DB_PASSWORD = "123456";                                     // 数据库密码
    public static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";                     // 数据库驱动
    public static final Integer INITIALSIZE = 5;                                           // 初始连接数
    public static final Integer MAXPOOLSIZE = 10;                                          // 最大连接数
    public static final Integer MAXWAIT = 3000;                                            // 最大等待时间

    public static Properties getProperties() {
        Properties properties = new Properties();
        properties.setProperty("url", DB_URL);
        properties.setProperty("username", DB_USERNAME);
        properties.setProperty("password", DB_PASSWORD);
        properties.setProperty("driverClassName", DB_DRIVER);
        properties.setProperty("initialSize", String.valueOf(INITIALSIZE));
        properties.setProperty("maxPoolSize", String.valueOf(MAXPOOLSIZE));
        properties.setProperty("maxWait", String.valueOf(MAXWAIT));
        return properties;
    }
}

